base: half-float reference zero initialize lsb
authorMassimo Valentini <mvalentini@src.gnome.org>
Sat, 16 Jan 2016 18:33:25 +0000 (19:33 +0100)
committerØyvind Kolås <pippin@gimp.org>
Sat, 16 Jan 2016 18:41:38 +0000 (19:41 +0100)
babl/base/type-half.c

index ac20ec92d6b7d19ac54b32721d3dfa67ddefe60e..5c0d079dd49e27bcaa4ccf34e3573fd3606e45e5 100644 (file)
@@ -138,6 +138,8 @@ static void halfp2doubles(void *target, void *source, long numel)
     int32_t xes;
     int e;
 
+    if (next)
+      *xp = 0;
     xp += next;  // Little Endian adjustment if necessary
     
     if( source == NULL || target == NULL ) // Nothing to convert (e.g., imag part of pure real)
@@ -175,7 +177,9 @@ static void halfp2doubles(void *target, void *source, long numel)
                 *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits
             }
         }
-        *xp++ = 0; // Skip over and zero the remaining 32 bits of the mantissa
+        xp++; // Skip over and zero the remaining 32 bits of the mantissa
+        if (!next)
+          *xp = 0;
     }
 }